#####################################################################
# File:         __init__.py
# Library:      KnowledgeEngine.Actions
#
# Copyright:    Copyright (c) 2002, Faulker Technologies.
# Author:       Brian Oliver
#
# Description:  This file initialises the KnowledgeEngine Actions
#               Package, and all sub packages containing Actions.
#####################################################################

#####################################################################
## Knowledge Engine Library Imports
# (none - done automatically. see below)

#####################################################################
## Zope Library Imports
from App.FindHomes import ppath

#####################################################################
## Python Library Imports
import os
    
#####################################################################    
## Import the KnowledgeEngine Elements
##
## Each KnowledgeEngine Action type resides in an independant package
## (named after the action) within the Actions folder
## in the KnowledgeEngine Zope Product
##
## By individually importing each Action type, they have a chance of
## performing their own initialisation, including appropriately
## registering themselves as part of the KnowledgeEngine product.

# The path to the KnowledgeEngine Action Packages
ACTIONS_PATH = ppath[0] + os.sep + "KnowledgeEngine" + os.sep + "Actions"

# Dynamically import each of the defined Action packages in the ACTIONS_PATH
for action in [file for file in os.listdir(ACTIONS_PATH) if os.path.isdir(ACTIONS_PATH + os.sep + file)]:

    # Import the current action (if it doesn't contain a .)
    if action.find(".") < 0:
        print "[KnowledgeEngine] Registering Action: " + action

        exec "from Products.KnowledgeEngine.Actions." + action + " import *"

#####################################################################    
